home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Franz PD / Franz PD Disk #065 (1990-04)(Amiga User Group Deutschland e.V.).zip / Franz PD Disk #065 (1990-04)(Amiga User Group Deutschland e.V.).adf / T90_V1.1 / T90.s < prev    next >
Text File  |  1989-07-02  |  39KB  |  2,168 lines

  1. *
  2. * T-90   V1.1   by ROGER FISCHLIN
  3. *                  STEIGERWALDWEG 6
  4. *                  D-6450 HANAU 7
  5. *                  WEST GERMANY
  6. *
  7. *          This program is public domain.
  8. *
  9. *
  10. *
  11. *
  12.  
  13.  
  14.     incdir       "fh1:include/"
  15.  
  16.     include    intuition/intuition.i
  17.     include    intuition/intuition_lib.i
  18.             include     exec/memory.i
  19.     include    exec/exec_lib.i
  20.     include    exec/execbase.i
  21.     include    graphics/graphics_lib.i
  22.     include    graphics/text.i
  23.     include    libraries/dos_lib.i
  24.     include    libraries/dos.i
  25.     include    libraries/dosextens.i
  26.     include    workbench/startup.i
  27.  
  28.  
  29.  
  30.     include    insert/Macros
  31.  
  32.  
  33.  
  34.  
  35.     clr.l    WB_Message    ; startup code
  36.     movem.l    d0/a0,-(sp)        
  37.  
  38.     jsr    OpenThem    ; get libraries 
  39.  
  40.     sub.l    a1,a1    
  41.     CALLEXEC     FindTask
  42.     move.l    d0,a4
  43.     tst.l    pr_CLI(a4)
  44.     beq.s    VonWB    
  45.                 
  46.     movem.l    (sp)+,d0/a0
  47.     bra    Ende_Startup
  48.  
  49. VonWB    lea.l    8(sp),sp    
  50.     lea    pr_MsgPort(a4),a0
  51.     CALLEXEC     WaitPort        
  52.     lea    pr_MsgPort(a4),a0
  53.     CALLEXEC     GetMsg        
  54.     move.l    d0,WB_Message
  55.     
  56.     move.l    d0,a0
  57.     move.l    sm_ArgList(a0),a0
  58.     cmp.l    #0,a0
  59.     beq    Ende_Startup
  60.     move.l    (a0),d1        
  61.     CALLDOS    CurrentDir
  62. Ende_Startup    bsr    Start
  63.     tst.l    WB_Message        
  64.     beq.s    SU_Label0        
  65.     CALLEXEC     Forbid        
  66.     move.l    WB_Message,a1
  67.     CALLEXEC     ReplyMsg
  68. SU_Label0    moveq    #0,d0
  69.     rts
  70.  
  71. WB_Message    dc.l    0
  72.  
  73. OpenThem    lea    dosname(pc),a1        ; open libs
  74.     moveq.l    #0,d0
  75.     CALLEXEC     OpenLibrary
  76.     move.l    d0,_DOSBase    
  77.     lea    intname(pc),a1                 
  78.     moveq.l    #0,d0        
  79.     CALLEXEC     OpenLibrary
  80.     move.l    d0,_IntuitionBase  
  81.     lea    grafname(pc),a1
  82.     moveq.l    #0,d0
  83.     CALLEXEC     OpenLibrary
  84.     move.l    d0,_GfxBase
  85.     rts
  86.  
  87. _DOSBase    dc.l    0
  88. dosname    DOSNAME
  89. _GfxBase    dc.l    0
  90. grafname    GRAFNAME
  91. _IntuitionBase    dc.l    0
  92. intname    INTNAME
  93. Window1    dc.l    0
  94. TOPAZ_80    dc.l    T_80name
  95.     dc.w    TOPAZ_EIGHTY
  96.     dc.b    FS_NORMAL,FPF_ROMFONT
  97.     even
  98. T_80name    dc.b    "topaz.font",0
  99.     even
  100. FONT80    dc.l    0
  101.  
  102.  
  103. Start    lea.l    TOPAZ_80,a0        ; opnen TOPAZ 80
  104.     CALLGRAF    OpenFont
  105.     move.l    d0,FONT80
  106.  
  107.     lea.l    Screendef,a0        ; open screen
  108.     CALLINT    OpenScreen
  109.     tst.l    d0
  110.     beq    QUIT1
  111.     move.l    d0,ScreenPtr1
  112.  
  113.  
  114.     lea.l    Windowdef1,a0        ; open window    
  115.     CALLINT    OpenWindow
  116.     tst.l    d0
  117.     beq    QUIT2
  118.     move.l    d0,Window1
  119.  
  120.     move.l    d0,a0        ; set colours
  121.     CALLINT    ViewPortAddress
  122.     move.l    d0,a0
  123.     move.l    #16,d0
  124.     lea.l    Palette,a1
  125.     CALLGRAF    LoadRGB4
  126.     CALLINT    RemakeDisplay
  127.  
  128.  
  129.     sub.l    a1,a1        ; DOS requester should appear in FileMaster's window
  130.     CALLEXEC    FindTask
  131.     move.l    d0,a0
  132.     move.l    pr_WindowPtr(a0),OldWindow
  133.     move.l    Window1,pr_WindowPtr(a0)
  134.  
  135.  
  136.  
  137.     move.l    ScreenPtr1,a0
  138.     CALLINT    ScreenToFront
  139.  
  140.     
  141. WindowPointer set Window1        
  142.  
  143.     SETAPEN    #2            ; bachground
  144.     RECTFILL    #0,#0,#640,#200
  145.     SETAPEN    #1            ; fields
  146.     RECTFILL    #55-2,#20,#160+55+2,#160+30+1
  147.     SETAPEN    #1
  148.     RECTFILL    #370+55-2,#20,#370+160+55+2,#160+30+1
  149.     SETAPEN    #0
  150.     RECTFILL    #55,#30,#160+55,#160+30
  151.     SETAPEN    #0
  152.     RECTFILL    #370+55,#30,#370+160+55,#160+30
  153.     SETDRMD    #RP_JAM1
  154.     WRITE    #55+80-(9*4),#20+7,#0,<"Player 1:">
  155.     WRITE    #370+55+80-(9*4),#20+7,#0,<"Player 2:">
  156.     jsr    MakeRects
  157.  
  158.     lea.l    W1_G1(pc),a0
  159.     move.l    WindowPointer,a1
  160.     sub.l    a2,a2
  161.     CALLINT    RefreshGadgets    
  162.     jsr    Info
  163.  
  164.     move.l    WindowPointer,a1
  165.     move.l    wd_RPort(a1),a1    
  166.     move.l    FONT80,a0
  167.     CALLGRAF    SetFont
  168.     SETDRMD    #RP_JAM2
  169.     SETBPEN    #2
  170.     jsr    LoadHiScores
  171.     jsr    MakeScores
  172.     jsr    LoadKeys
  173.  
  174. Inwait    jsr    DisplayHiScores
  175.  
  176. wait    move.l    Window1,a0        ; wait .....
  177.     move.l    wd_UserPort(a0),a0
  178.     move.l    a0,a5
  179.     CALLEXEC    WaitPort        
  180.     move.l    a5,a0
  181.     CALLEXEC    GetMsg        ; get message
  182.     move.l    d0,a1    
  183.     move.l    im_Class(a1),d4    ; get data
  184.     move.w    im_Code(a1),d5
  185.     move.w    im_Qualifier(a1),d3
  186.     move.l    im_IAddress(a1),a4
  187.     CALLEXEC     ReplyMsg        ; reply message
  188.     
  189. waitGadget    moveq.l    #0,d0        
  190.     move.b    gg_GadgetID+1(a4),d0    ; get gadget ID
  191.  
  192.     cmp.l    #GADGETUP,d4
  193.     bne    wait
  194. GameEXIT    cmp.b    #3,d0
  195.     beq    QUIT
  196.     tst.b    d0
  197.     beq    ABOUT
  198.     cmp.b    #1,d0
  199.     beq    GAME_ONE
  200.     cmp.b    #2,d0
  201.     beq    GAME_TWO
  202.     cmp.b    #4,d0
  203.     beq    DEFINE_KEYS
  204.     
  205.     bra    QUIT
  206.     
  207.  
  208.  
  209.  
  210. Error    move.l    ScreenPtr1,a0
  211.     CALLINT    DisplayBeep
  212.     bra    wait
  213.  
  214.  
  215. QUIT    sub.l    a1,a1
  216.     CALLEXEC    FindTask
  217.     move.l    d0,a0
  218.     move.l    OldWindow,pr_WindowPtr(a0)
  219.     move.l    Window1,a0        ; bye, bye !
  220.     CALLINT    CloseWindow
  221.     move.l    ScreenPtr1,a0
  222.     CALLINT    CloseScreen
  223.     moveq.l    #0,d0
  224.     rts
  225.  
  226. OldWindow    dc.l    0
  227.  
  228. Screendef    dc.w    0,0,640,200,3
  229.     dc.b    0,1
  230.     dc.w    V_HIRES    
  231.     dc.w    CUSTOMSCREEN!SCREENBEHIND
  232.     dc.l    TOPAZ_80
  233.     dc.l    .S_Title,0,0
  234.     
  235.     even
  236. .S_Title    dc.b    " T90  V1.1  by Roger Fischlin 3/1990            ",0
  237.     even
  238.  
  239.  
  240. Windowdef1    dc.w    0,0,640,200
  241.     dc.b    7,1
  242.     dc.l    GADGETUP
  243.     dc.l    ACTIVATE!SMART_REFRESH!BACKDROP!SMART_REFRESH!BORDERLESS
  244.     dc.l    W1_G1
  245.     dc.l    0
  246.     dc.l    0
  247. ScreenPtr1    dc.l    0,0
  248.     dc.w    0,0,0,0,CUSTOMSCREEN
  249.  
  250. W1_G1    GADGET    W1_G2,270,75,100,0,<"About">,1,4
  251. W1_G2    GADGET    W1_G3,270,95,100,1,<"One Player">,1,4
  252. W1_G3    GADGET    W1_G4,270,115,100,2,<"Two Players">,1,4
  253. W1_G4    GADGET    W1_G5,270,135,100,3,<"Quit">,1,4
  254. W1_G5    GADGET    0,270,55,100,4,<"Keys">,1,4
  255.  
  256.  
  257. QUIT3    move.l    Window1,a0        
  258.     CALLINT    CloseWindow
  259.  
  260. QUIT2    move.l    ScreenPtr1,a0
  261.     CALLINT    CloseScreen
  262.  
  263. QUIT1    move.l    #RECOVERY_ALERT,d0    ; error message
  264.     move.l    #30,d1
  265.     lea.l    ErrorText,a0
  266.     CALLINT    DisplayAlert
  267.  
  268.     moveq.l    #0,d0
  269.     rts
  270.  
  271.  
  272. ErrorText    dc.w    60
  273.     dc.b    17
  274.     dc.b    "T 90 : ERROR !?! I cannot open the screen / window !"
  275.     dc.b     0,0
  276.     even
  277.  
  278.  
  279.  
  280. MakeRects
  281. WindowPointer set Window1        
  282.  
  283.     SETAPEN    #1            ; score
  284.     RECTFILL    #270,#20,#370,#40+2
  285.     SETAPEN    #0
  286.     RECTFILL    #270+2,#21,#370-2,#41
  287.     SETAPEN    #1            ; next piece
  288.     RECTFILL    #270,#160,#370,#191
  289.     SETAPEN    #0
  290.     RECTFILL    #270+2,#161,#370-2,#190
  291.     SETAPEN    #0
  292.     RECTFILL    #55,#30,#160+55,#160+30
  293.     SETAPEN    #0
  294.     RECTFILL    #370+55,#30,#370+160+55,#160+30
  295.     jmp    PrepareFields
  296.  
  297.  
  298. ShowNextPiece    SETAPEN    #0
  299.     RECTFILL    #270+2,#161,#370-2,#190
  300.     lea.l    Pieces(pc),a0        ; show next piece
  301.     move.l    NextPiece,d0
  302.     lsl.l    #4,d0
  303.     add.l    d0,a0
  304.     move.l    (a0),a0
  305.     move.l    8(a0),d0
  306.     lea.l    20(a0),a1
  307.     lea.l    BlockImages(pc),a2    ; put up image structures
  308.     moveq.l    #0,d1
  309. .L0    clr.l    ig_NextImage(a2)
  310.     move.b    d0,ig_PlaneOnOff(a2)
  311.     move.l    d1,d2
  312.     and.l    #3,d2
  313.     lsl.l    #4,d2
  314.     addq.l    #2,d2
  315.     move.w    d2,ig_LeftEdge(a2)
  316.     move.l    d1,d2
  317.     lsr.w    #2,d2
  318.     lsl.w    #3,d2
  319.     addq.l    #2,d2
  320.     move.w    d2,ig_TopEdge(a2)
  321.     move.w    #16-4,ig_Width(a2)
  322.     move.w    #8-2,ig_Height(a2)
  323.     move.w    #3,ig_Depth(a2)
  324.     tst.b    (a1)+
  325.     beq.s    .L1
  326.     lea.l    ig_SIZEOF(a2),a2
  327.     move.l    a2,-4(a2)        ; pointer to next image structure
  328. .L1    addq.l    #1,d1
  329.     cmp.b    #12,d1
  330.     bne    .L0
  331.     clr.l    -4(a2)        ; clear last pointer 
  332.     move.l    (a0),d2
  333.     move.l    4(a0),d3
  334.     lsl.l    #3,d2
  335.     lsl.l    #2,d3
  336.     move.l    #270+50,d0
  337.     move.l    #161+14,d1
  338.     sub.l    d2,d0
  339.     sub.l    d3,d1
  340.     move.l    Window1,a0
  341.     move.l    wd_RPort(a0),a0
  342.     lea.l    BlockImages,a1
  343.     CALLINT    DrawImage
  344.     rts
  345.  
  346.  
  347. Palette    dc.w    $000,$eee,$876,$839,$04d,$e20,$3c0,$fd0
  348.     
  349.     ds.b    100
  350.  
  351. FieldA    ds.b    12*21
  352. FieldB    ds.b    12*21
  353.  
  354. ScoreA    dc.l    0
  355. ScoreB    dc.l    0
  356. Time    dc.l    0
  357. NextPiece    dc.l    0
  358. PieceA    dc.l    2
  359. PieceB    dc.l    0
  360. DegreeA    dc.l    0
  361. DegreeB    dc.l    0
  362. PositionAX    dc.l    0
  363. PositionAY    dc.l    0
  364. PositionBX    dc.l    0
  365. PositionBY    dc.l    0
  366. Timer    dc.l    0
  367. Clock    dc.l    0
  368. GameOver    dc.w    0
  369. Player    dc.b    0
  370.     even
  371.  
  372.  
  373.  
  374.     dc.b    "KEYS:"
  375.  
  376. LeftA    dc.w    $20
  377. RightA    dc.w    $22
  378. RotateA    dc.w    $21
  379. DropA    dc.w    $40
  380.  
  381. LeftB    dc.w    $2d
  382. RightB    dc.w    $2f
  383. RotateB    dc.w    $2e
  384. DropB    dc.w    $43
  385.  
  386.  
  387. PrepareFields    lea.l    FieldA(pc),a0    ; clear it
  388.     lea.l    FieldB(pc),a1
  389.     move.l    #19,d0
  390. .Q1    move.l    #9,d1
  391.     move.b    #$ff,(a0)+
  392.     move.b    #$ff,(a1)+
  393. .Q2    move.b    #0,(a0)+
  394.     move.b    #0,(a1)+
  395.     dbra    d1,.Q2
  396.     move.b    #$ff,(a0)+
  397.     move.b    #$ff,(a1)+
  398.     dbra    d0,.Q1
  399.     
  400.     move.l    #11,d0
  401. .Q3    move.b    #$ff,(a0)+
  402.     move.b    #$ff,(a1)+
  403.     dbra    d0,.Q3
  404.     rts
  405.  
  406.  
  407. Pieces    dc.l    Piece1_0,Piece1_1,Piece1_2,Piece1_3
  408.     dc.l    Piece2_0,Piece2_1,Piece2_2,Piece2_3
  409.     dc.l    Piece3_0,Piece3_1,Piece3_2,Piece3_3
  410.     dc.l    Piece4_0,Piece4_1,Piece4_2,Piece4_3
  411.     dc.l    Piece5_0,Piece5_1,Piece5_2,Piece5_3
  412.     dc.l    Piece6_0,Piece6_1,Piece6_2,Piece6_3
  413.     dc.l    Piece7_0,Piece7_1,Piece7_2,Piece7_3
  414.  
  415.  
  416.  
  417. Piece1_0    dc.l    3,2    ; size
  418.     dc.l    1    ; colour
  419.     dc.l    0,0    ; offset 
  420.     dc.l    $00FF0000    ; data
  421.     dc.l    $FFFFFF00
  422.     dc.l    0,0
  423. Piece1_1    dc.l    2,3    ; size
  424.     dc.l    1    ; colour
  425.     dc.l    1,0    ; offset 
  426.     dc.l    $FF000000    ; data
  427.     dc.l    $FFFF0000    
  428.     dc.l    $FF000000
  429.     dc.l    0
  430. Piece1_2    dc.l    3,2    ; size
  431.     dc.l    1    ; colour
  432.     dc.l    -1,1    ; offset 
  433.     dc.l    $FFFFFF00    ; data
  434.     dc.l    $00FF0000
  435.     dc.l    0,0
  436. Piece1_3    dc.l    2,3    ; size
  437.     dc.l    1    ; colour
  438.     dc.l    0,-1    ; offset 
  439.     dc.l    $00FF0000    ; data
  440.     dc.l    $FFFF0000
  441.     dc.l    $00FF0000
  442.     dc.l    0
  443.  
  444. Piece2_0    dc.l    3,2    ; size
  445.     dc.l    2    ; colour
  446.     dc.l    -1,0    ; offset 
  447.     dc.l    $00FFFF00    ; data
  448.     dc.l    $FFFF0000
  449.     dc.l    0
  450.     dc.l    0
  451. Piece2_1    dc.l    2,3    ; size
  452.     dc.l    2    ; colour
  453.     dc.l    1,0    ; offset 
  454.     dc.l    $FF000000    ; data
  455.     dc.l    $FFFF0000
  456.     dc.l    $00FF0000
  457.     dc.l    0
  458. Piece2_2    dc.l    3,2    ; size
  459.     dc.l    2    ; colour
  460.     dc.l    -1,0    ; offset 
  461.     dc.l    $00FFFF00    ; data
  462.     dc.l    $FFFF0000
  463.     dc.l    $0
  464.     dc.l    0
  465. Piece2_3    dc.l    2,3    ; size
  466.     dc.l    2    ; colour
  467.     dc.l    1,0    ; offset 
  468.     dc.l    $FF000000    ; data
  469.     dc.l    $FFFF0000
  470.     dc.l    $00FF0000
  471.     dc.l    0
  472.  
  473. Piece3_0    dc.l    3,2    ; size
  474.     dc.l    3    ; colour
  475.     dc.l    -1,0    ; offset 
  476.     dc.l    $FFFF0000    ; data
  477.     dc.l    $00FFFF00
  478.     dc.l    0
  479.     dc.l    0
  480. Piece3_1    dc.l    2,3    ; size
  481.     dc.l    3    ; colour
  482.     dc.l    1,0    ; offset 
  483.     dc.l    $00FF0000    ; data
  484.     dc.l    $FFFF0000
  485.     dc.l    $FF000000
  486.     dc.l    0
  487. Piece3_2    dc.l    3,2    ; size
  488.     dc.l    3    ; colour
  489.     dc.l    -1,0    ; offset 
  490.     dc.l    $FFFF0000    ; data
  491.     dc.l    $00FFFF00
  492.     dc.l    $0
  493.     dc.l    0
  494. Piece3_3    dc.l    2,3    ; size
  495.     dc.l    3    ; colour
  496.     dc.l    1,0    ; offset 
  497.     dc.l    $00FF0000    ; data
  498.     dc.l    $FFFF0000
  499.     dc.l    $FF000000
  500.     dc.l    0
  501.  
  502. Piece4_0    dc.l    4,1    ; size
  503.     dc.l    4    ; colour
  504.     dc.l    -1,0    ; offset 
  505.     dc.l    $FFFFFFFF    ; data
  506.     dc.l    0
  507.     dc.l    0
  508.     dc.l    0
  509. Piece4_1    dc.l    1,4    ; size
  510.     dc.l    4    ; colour
  511.     dc.l    1,0    ; offset 
  512.     dc.l    $FF000000    ; data
  513.     dc.l    $FF000000
  514.     dc.l    $FF000000
  515.     dc.l    $FF000000
  516. Piece4_2    dc.l    4,1    ; size
  517.     dc.l    4    ; colour
  518.     dc.l    -1,0    ; offset 
  519.     dc.l    $FFFFFFFF    ; data
  520.     dc.l    $0
  521.     dc.l    $0
  522.     dc.l    0
  523. Piece4_3    dc.l    1,4    ; size
  524.     dc.l    4    ; colour
  525.     dc.l    1,0    ; offset 
  526.     dc.l    $FF000000    ; data
  527.     dc.l    $FF000000
  528.     dc.l    $FF000000
  529.     dc.l    $FF000000
  530.  
  531. Piece5_0
  532. Piece5_1
  533. Piece5_2
  534. Piece5_3    dc.l    2,2    ; size
  535.     dc.l    5    ; colour
  536.     dc.l    1,0    ; offset 
  537.     dc.l    $FFFF0000    ; data
  538.     dc.l    $FFFF0000
  539.     dc.l    0
  540.     dc.l    0
  541.  
  542. Piece6_0    dc.l    3,2    ; size
  543.     dc.l    6    ; colour
  544.     dc.l    -1,0    ; offset 
  545.     dc.l    $0000FF00    ; data
  546.     dc.l    $FFFFFF00
  547.     dc.l    0
  548.     dc.l    0
  549. Piece6_1    dc.l    2,3    ; size
  550.     dc.l    6    ; colour
  551.     dc.l    1,0    ; offset 
  552.     dc.l    $FF000000    ; data
  553.     dc.l    $FF000000
  554.     dc.l    $FFFF0000
  555.     dc.l    0
  556. Piece6_2    dc.l    3,2    ; size
  557.     dc.l    6    ; colour
  558.     dc.l    -1,0    ; offset 
  559.     dc.l    $FFFFFF00    ; data
  560.     dc.l    $FF000000
  561.     dc.l    $0
  562.     dc.l    0
  563. Piece6_3    dc.l    2,3    ; size
  564.     dc.l    6    ; colour
  565.     dc.l    1,0    ; offset 
  566.     dc.l    $FFFF0000    ; data
  567.     dc.l    $00FF0000
  568.     dc.l    $00FF0000
  569.     dc.l    0
  570.  
  571.  
  572. Piece7_0    dc.l    3,2    ; size
  573.     dc.l    7    ; colour
  574.     dc.l    -1,0    ; offset 
  575.     dc.l    $FF000000    ; data
  576.     dc.l    $FFFFFF00
  577.     dc.l    0
  578.     dc.l    0
  579. Piece7_1    dc.l    2,3    ; size
  580.     dc.l    7    ; colour
  581.     dc.l    1,0    ; offset 
  582.     dc.l    $FFFF0000    ; data
  583.     dc.l    $FF000000
  584.     dc.l    $FF000000
  585.     dc.l    0
  586. Piece7_2    dc.l    3,2    ; size
  587.     dc.l    7    ; colour
  588.     dc.l    -1,0    ; offset 
  589.     dc.l    $FFFFFF00    ; data
  590.     dc.l    $0000FF00
  591.     dc.l    $0
  592.     dc.l    0
  593. Piece7_3    dc.l    2,3    ; size
  594.     dc.l    7    ; colour
  595.     dc.l    1,0    ; offset 
  596.     dc.l    $00FF0000    ; data
  597.     dc.l    $00FF0000
  598.     dc.l    $FFFF0000
  599.     dc.l    0
  600.  
  601. Windowdef2    dc.w    200,25,260,140
  602.     dc.b    1,1
  603.     dc.l    GADGETUP
  604.     dc.l    ACTIVATE!SMART_REFRESH!SMART_REFRESH
  605.     dc.l    W2_G1
  606.     dc.l    0
  607.     dc.l    0
  608. ScreenPtr2    dc.l    0,0
  609.     dc.w    0,0,0,0,CUSTOMSCREEN
  610.  
  611. W2_G1    GADGET    0,80,120,100,0,<"OK">,1,4
  612.  
  613. Window2    dc.l    0
  614.  
  615. WindowPointer set Window2
  616.  
  617. ABOUT    jsr    Info
  618.     jmp    wait
  619.  
  620.  
  621. Info    move.l    ScreenPtr1,ScreenPtr2
  622.     lea.l    Windowdef2(pc),a0
  623.     CALLINT    OpenWindow
  624.     move.l    d0,Window2
  625.     tst.l    d0
  626.     beq    .X
  627.     
  628.     SETAPEN    #2
  629.     RECTFILL    #2,#1,#257,#138
  630.  
  631.     lea.l    W2_G1(pc),a0
  632.     move.l    WindowPointer,a1
  633.     sub.l    a2,a2
  634.     CALLINT    RefreshGadgets    
  635.     SETDRMD    #RP_JAM1
  636.     
  637.     WRITE    #((260-(4*8))/2)+1,#16,#0,<"T-90">
  638.     WRITE    #(260-(4*8))/2,#15,#1,<"T-90">
  639.     WRITE    #((260-(10*8))/2)+1,#26,#0,<"­­­­­­­­­­">
  640.     WRITE    #(260-(10*8))/2,#25,#1,<"­­­­­­­­­­">
  641.     
  642.     WRITE    #((260-(22*8))/2)+1,#36,#0,<"Release 1.1  /  4.3.90">
  643.     WRITE    #(260-(22*8))/2,#35,#1,<"Release 1.1  /  4.3.90">
  644.     WRITE    #((260-(17*8))/2)+1,#56,#0,<"by Roger Fischlin">
  645.     WRITE    #(260-(17*8))/2,#55,#7,<"by Roger Fischlin">
  646.     WRITE    #((260-(17*8))/2)+1,#66,#0,<"   Steigerwaldweg 6">
  647.     WRITE    #(260-(17*8))/2,#65,#7,<"   Steigerwaldweg 6">
  648.     WRITE    #((260-(17*8))/2)+1,#76,#0,<"   D-6450 Hanau 7">
  649.     WRITE    #(260-(17*8))/2,#75,#7,<"   D-6450 Hanau 7">
  650.     WRITE    #((260-(17*8))/2)+1,#86,#0,<"   West Germany">
  651.     WRITE    #(260-(17*8))/2,#85,#7,<"   West Germany">
  652.     WRITE    #((260-(25*8))/2)+1,#106,#0,<"T-90 is public domain !!!">
  653.     WRITE    #(260-(25*8))/2,#105,#1,<"T-90 is public domain !!!">
  654.  
  655.     
  656.     move.l    Window2,a0        ; wait .....
  657.     move.l    wd_UserPort(a0),a0
  658.     CALLEXEC    WaitPort        
  659.     move.l    Window2,a0
  660.     CALLINT    CloseWindow
  661. .X    rts
  662.  
  663. WindowPointer set Window1
  664.  
  665.  
  666. BlockImages    ds.b    ig_SIZEOF*16
  667.  
  668. ********************************************************
  669. *
  670. *  Player 1:
  671. *
  672. ********************************************************
  673.  
  674. DisplayA    lea.l    Pieces(pc),a0
  675.     move.l    PieceA,d0
  676.     lsl.l    #4,d0
  677.     add.l    d0,a0
  678.     move.l    (a0),a0
  679.     move.l    8(a0),d0
  680.  
  681. MakeBIA    lea.l    20(a0),a1
  682.     lea.l    BlockImages(pc),a2    ; put up image structures
  683.     moveq.l    #0,d1
  684. .L0    clr.l    ig_NextImage(a2)
  685.     move.b    d0,ig_PlaneOnOff(a2)
  686.     move.l    d1,d2
  687.     and.l    #3,d2
  688.     lsl.l    #4,d2
  689.     addq.l    #2,d2
  690.     move.w    d2,ig_LeftEdge(a2)
  691.     move.l    d1,d2
  692.     lsr.w    #2,d2
  693.     lsl.w    #3,d2
  694.     addq.l    #2,d2
  695.     move.w    d2,ig_TopEdge(a2)
  696.     move.w    #16-4,ig_Width(a2)
  697.     move.w    #8-2,ig_Height(a2)
  698.     move.w    #3,ig_Depth(a2)
  699.     tst.b    (a1)+
  700.     beq    .L1
  701.     lea.l    ig_SIZEOF(a2),a2
  702.     move.l    a2,-4(a2)        ; pointer to next image structure
  703. .L1    addq.l    #1,d1
  704.     cmp.b    #16,d1
  705.     bne    .L0
  706.     clr.l    -4(a2)        ; clear last pointer 
  707.     
  708.     move.l    PieceA,d0        ; display image
  709.     lsl.l    #4,d0
  710.     move.l    DegreeA,d1
  711.     lsl.l    #3,d1
  712.     add.l    d0,d1
  713.     lea.l    Pieces(pc),a1
  714.     add.l    d1,a1
  715.     move.l    (a1),a1
  716.     move.l    PositionAX,d0
  717.     lsl.w    #4,d0
  718.     add.w    #55,d0
  719.     move.l    PositionAY,d1
  720.     lsl.w    #3,d1
  721.     add.w    #30,d1
  722.     move.l    Window1,a0
  723.     move.l    wd_RPort(a0),a0
  724.     lea.l    BlockImages,a1
  725.     CALLINT    DrawImage
  726.     rts
  727.  
  728. RotatePieceA    move.l    PieceA,d0    ; check if you can rotate it !
  729.     lsl.l    #4,d0
  730.     move.l    DegreeA,d1
  731.     addq.l    #1,d1
  732.     and.l    #3,d1
  733.     lsl.l    #2,d1
  734.     add.l    d0,d1
  735.     lea.l    Pieces,a0
  736.     add.l    d1,a0
  737.     move.l    (a0),a0    
  738.     move.l    12(a0),d0
  739.     move.l    16(a0),d1
  740.     add.l    PositionAX,d0
  741.     add.l    PositionAY,d1
  742.     jsr    CheckA
  743.     tst.l    d0
  744.     bne    .wait
  745.  
  746.     move.l    PieceA,d0        ; rotate piece of player A
  747.     lsl.l    #4,d0
  748.     move.l    DegreeA,d1
  749.     lsl.l    #2,d1
  750.     add.l    d0,d1
  751.     lea.l    Pieces,a0
  752.     
  753.     add.l    d1,a0
  754.     move.l    (a0),a0
  755.     moveq.l    #0,d0
  756.     jsr    MakeBIA        ; clear old piece
  757.     
  758.     add.l    #1,DegreeA
  759.     and.l    #3,DegreeA
  760.  
  761.     move.l    PieceA,d0
  762.     lsl.l    #4,d0
  763.     move.l    DegreeA,d1
  764.     lsl.l    #2,d1
  765.     add.l    d0,d1
  766.     lea.l    Pieces,a0
  767.     add.l    d1,a0
  768.     move.l    (a0),a0
  769.     move.l    12(a0),d0
  770.     move.l    16(a0),d1
  771.     add.l    d0,PositionAX
  772.     add.l    d1,PositionAY
  773.     move.l    8(a0),d0
  774.     jsr    MakeBIA
  775. .wait    jmp    GameWait
  776.  
  777. Key    and.l    #$7f,d5
  778.     cmp.w    LeftA,d5        ; any useful key pressed ???
  779.     beq    MoveLeftA
  780.     cmp.w    RightA,d5
  781.     beq    MoveRightA
  782.     cmp.w    RotateA,d5
  783.     beq    RotatePieceA
  784.     cmp.w    DropA,d5
  785.     beq    DropPieceA
  786.     jmp    GameWait
  787.  
  788. MoveLeftA    move.l    PieceA,d0        
  789.     lsl.l    #4,d0
  790.     move.l    DegreeA,d1
  791.     lsl.l    #2,d1
  792.     add.l    d0,d1
  793.     lea.l    Pieces,a0
  794.     add.l    d1,a0
  795.     move.l    (a0),a0
  796.     move.l    PositionAX,d0
  797.     subq.l    #1,d0
  798.     move.l    PositionAY,d1
  799.     jsr    CheckA        ; check if there's any room
  800.     tst.l    d0
  801.     bne    .wait
  802.     moveq.l    #0,d0
  803.     jsr    MakeBIA        ; clear old piece
  804.     move.l    PieceA,d0
  805.     lsl.l    #4,d0
  806.     move.l    DegreeA,d1
  807.     lsl.l    #2,d1
  808.     add.l    d0,d1
  809.     lea.l    Pieces,a0
  810.     add.l    d1,a0
  811.     move.l    (a0),a0
  812.     sub.l    #1,PositionAX
  813.     move.l    8(a0),d0
  814.     jsr    MakeBIA
  815. .wait    jmp    GameWait
  816.  
  817. MoveRightA    move.l    PieceA,d0        
  818.     lsl.l    #4,d0
  819.     move.l    DegreeA,d1
  820.     lsl.l    #2,d1
  821.     add.l    d0,d1
  822.     lea.l    Pieces,a0
  823.     add.l    d1,a0
  824.     move.l    (a0),a0
  825.     move.l    PositionAX,d0
  826.     addq.l    #1,d0
  827.     move.l    PositionAY,d1
  828.     jsr    CheckA
  829.     tst.l    d0
  830.     bne    .wait
  831.     moveq.l    #0,d0
  832.     jsr    MakeBIA        ; clear old piece
  833.     move.l    PieceA,d0
  834.     lsl.l    #4,d0
  835.     move.l    DegreeA,d1
  836.     lsl.l    #2,d1
  837.     add.l    d0,d1
  838.     lea.l    Pieces,a0
  839.     add.l    d1,a0
  840.     move.l    (a0),a0
  841.     add.l    #1,PositionAX
  842.     move.l    8(a0),d0
  843.     jsr    MakeBIA
  844. .wait    jmp    GameWait
  845.  
  846. FallA    move.l    PieceA,d0        
  847.     lsl.l    #4,d0
  848.     move.l    DegreeA,d1
  849.     lsl.l    #2,d1
  850.     add.l    d0,d1
  851.     lea.l    Pieces,a0
  852.     add.l    d1,a0
  853.     move.l    (a0),a0
  854.     move.l    PositionAX,d0
  855.     move.l    PositionAY,d1
  856.     addq.l    #1,d1
  857.     jsr    CheckA
  858.     tst.l    d0
  859.     bne    Drop_waitA
  860.     moveq.l    #0,d0
  861.     jsr    MakeBIA        ; clear old piece
  862.     move.l    PieceA,d0
  863.     lsl.l    #4,d0
  864.     move.l    DegreeA,d1
  865.     lsl.l    #2,d1
  866.     add.l    d0,d1
  867.     lea.l    Pieces,a0
  868.     add.l    d1,a0
  869.     move.l    (a0),a0
  870.     add.l    #1,PositionAY
  871.     move.l    8(a0),d0
  872.     jsr    MakeBIA
  873.     jmp    GameWait
  874.  
  875.  
  876. DropPieceA    move.l    PieceA,d0        
  877.     lsl.l    #4,d0
  878.     move.l    DegreeA,d1
  879.     lsl.l    #2,d1
  880.     add.l    d0,d1
  881.     lea.l    Pieces,a0
  882.     add.l    d1,a0
  883.     move.l    (a0),a0
  884.     move.l    PositionAX,d0
  885.     move.l    PositionAY,d1
  886.     addq.l    #1,d1
  887.     jsr    CheckA
  888.     tst.l    d0
  889.     bne    Drop_waitA
  890.     add.l    #1,ScoreA
  891.     moveq.l    #0,d0
  892.     jsr    MakeBIA        ; clear old piece
  893.     move.l    PieceA,d0
  894.     lsl.l    #4,d0
  895.     move.l    DegreeA,d1
  896.     lsl.l    #2,d1
  897.     add.l    d0,d1
  898.     lea.l    Pieces,a0
  899.     add.l    d1,a0
  900.     move.l    (a0),a0
  901.     add.l    #1,PositionAY
  902.     move.l    8(a0),d0
  903.     jsr    MakeBIA
  904.     jmp    DropPieceA
  905.  
  906. Drop_waitA    move.l    PieceA,d0        ; copy piece into field
  907.     lsl.l    #4,d0
  908.     move.l    DegreeA,d1
  909.     lsl.l    #2,d1
  910.     add.l    d0,d1
  911.     lea.l    Pieces,a0
  912.     add.l    d1,a0
  913.     move.l    (a0),a0
  914.     lea.l    FieldA(pc),a1
  915.     move.l    PositionAX,d0
  916.     addq.l    #1,d0
  917.     add.l    d0,a1
  918.     move.l    PositionAY,d0
  919.     mulu    #12,d0
  920.     add.l    d0,a1
  921.     lea.l    20(a0),a0
  922.     moveq.l    #3,d2
  923.     moveq.l    #3,d3
  924. .E1    moveq.l    #3,d4
  925. .E2    move.b    (a0)+,d0
  926.     or.b    d0,(a1)+
  927.     dbra    d4,.E2
  928.     add.l    #12-4,a1
  929.     dbra    d3,.E1
  930.  
  931.     jsr    ShowScores
  932.     jsr    DeleteRowA
  933.     jsr    NewPieceA
  934.     tst.l    d0
  935.     bne    GameQUITA
  936.     jmp    GameWait
  937.     
  938.     
  939.  
  940.  
  941. CheckA    movem.l    d1-d7/a0-a5,-(sp)    ; check if there are no blocks
  942.     lea.l    FieldA(pc),a1
  943.     addq.l    #1,d0
  944.     add.l    d0,a1
  945.     mulu    #12,d1
  946.     add.l    d1,a1
  947.     moveq.l    #3,d2
  948.     lea.l    .L1(pc),a2
  949.     moveq.l    #3,d3
  950. .E1    moveq.l    #3,d4
  951. .E2    move.b    (a1)+,(a2)+
  952.     dbra    d4,.E2
  953.     add.l    #12-4,a1
  954.     dbra    d3,.E1
  955.  
  956.     move.l    20(a0),d0
  957.     move.l    .L1,d1
  958.     and.l    d0,d1
  959.     move.l    d1,d0
  960.     tst.l    d0
  961.     bne    .E3
  962.     move.l    24(a0),d0
  963.     move.l    .L2,d1
  964.     and.l    d0,d1
  965.     move.l    d1,d0
  966.     tst.l    d0
  967.     bne    .E3
  968.  
  969.     move.l    28(a0),d0
  970.     move.l    .L3,d1
  971.     and.l    d0,d1
  972.     move.l    d1,d0
  973.     tst.l    d0
  974.     bne    .E3
  975.     move.l    32(a0),d0
  976.     move.l    .L4,d1
  977.     and.l    d0,d1
  978.     move.l    d1,d0
  979. .E3    movem.l    (sp)+,d1-d7/a0-a5
  980.     rts
  981. .L1    dc.l    0
  982. .L2    dc.l    0
  983. .L3    dc.l    0
  984. .L4    dc.l    0
  985.  
  986.  
  987. NewPieceA    jsr    GetPiece
  988.     move.l    d0,PieceA
  989.     lsl.l    #4,d0
  990.     add.l    #Pieces,d0
  991.     move.l    d0,a0
  992.     move.l    (a0),a0
  993.     moveq.l    #4,d0
  994.     move.l    d0,PositionAX
  995.     moveq.l    #0,d1
  996.     move.l    d1,PositionAY
  997.     clr.l    DegreeA
  998.     jsr    CheckA
  999.     tst.l    d0
  1000.     bne.s    .L1
  1001.     jsr    DisplayA
  1002.     moveq.l    #0,d0
  1003. .L1    rts
  1004.  
  1005.  
  1006. DeleteRowA    moveq.l    #1,d0        ; delete all posible rows / player A
  1007. .W1    move.l    d0,-(sp)
  1008.     bsr.s    .KillRowA
  1009.     move.l    (sp)+,d0
  1010.     addq.l    #1,d0
  1011.     cmp.w    #20,d0        ; until row 20
  1012.     bne.s    .W1
  1013.     jmp    ShowScores        ; update score
  1014.  
  1015. .KillRowA    lea.l    FieldA+1(pc),a0    ; delete row if possible
  1016.     move.l    d0,d1
  1017.     mulu    #12,d1
  1018.     add.l    d1,a0
  1019.  
  1020.     move.l    #9,d1        ; check if there are spaces
  1021. .T1    tst.b    (a0)+
  1022.     beq    .NoMove
  1023.     dbra    d1,.T1
  1024.  
  1025. .T5    add.l    #10,ScoreA
  1026.     move.l    d0,d1
  1027.     mulu    #12,d1
  1028.     lea.l    FieldA+12(pc),a1
  1029.     lea.l    FieldA(pc),a0
  1030.     add.l    d1,a0
  1031.     add.l    d1,a1
  1032. .T2    move.b    -(a0),-(a1)
  1033.     cmp.l    #FieldA,a0
  1034.     bne.s    .T2
  1035.     lea.l    FieldA+1(pc),a0
  1036.     move.l    #9,d0
  1037. .T3    move.b    #0,(a0)+
  1038.     dbra    d0,.T3
  1039.         
  1040.     move.l    Window1,a1        ; scoll it
  1041.     move.l    wd_RPort(a1),a1
  1042.     moveq.l    #0,d0    
  1043.     moveq.l    #-8,d1
  1044.     move.l    #55,d2
  1045.     move.l    #30,d3
  1046.     move.l    #160+55,d4
  1047.     move.l    4(sp),d5
  1048.     addq.l    #1,d5
  1049.     lsl.l    #3,d5
  1050.     add.l    #30,d5
  1051.     CALLGRAF    ScrollRaster
  1052.  
  1053.     SETAPEN    #0            
  1054.     RECTFILL    #55,#30,#160+55,#30+8
  1055. .NoMove    rts
  1056.  
  1057.  
  1058. GameOverA    SETAPEN    #1
  1059.     RECTFILL    #55+16-2,#30+65-1,#55+160-16+2,#30+65+30+1
  1060.     SETAPEN    #2
  1061.     RECTFILL    #55+16,#30+65,#55+160-16,#30+65+30
  1062.     SETDRMD    #RP_JAM1
  1063.     WRITE    #56+80-(11*4),#95+11+7,#0,<"GAME OVER !">
  1064.     WRITE    #55+80-(11*4),#95+11+6,#7,<"GAME OVER !">
  1065.     rts
  1066.  
  1067. ********************************************************
  1068. *
  1069. *  Player 2:
  1070. *
  1071. ********************************************************
  1072.  
  1073. DisplayB    lea.l    Pieces(pc),a0
  1074.     move.l    PieceB,d0
  1075.     lsl.l    #4,d0
  1076.     add.l    d0,a0
  1077.     move.l    (a0),a0
  1078.     move.l    8(a0),d0
  1079.  
  1080. MakeBIB    lea.l    20(a0),a1
  1081.     lea.l    BlockImages(pc),a2    ; put up image structures
  1082.     moveq.l    #0,d1
  1083. .L0    clr.l    ig_NextImage(a2)
  1084.     move.b    d0,ig_PlaneOnOff(a2)
  1085.     move.l    d1,d2
  1086.     and.l    #3,d2
  1087.     lsl.l    #4,d2
  1088.     addq.l    #2,d2
  1089.     move.w    d2,ig_LeftEdge(a2)
  1090.     move.l    d1,d2
  1091.     lsr.w    #2,d2
  1092.     lsl.w    #3,d2
  1093.     addq.l    #2,d2
  1094.     move.w    d2,ig_TopEdge(a2)
  1095.     move.w    #16-4,ig_Width(a2)
  1096.     move.w    #8-2,ig_Height(a2)
  1097.     move.w    #3,ig_Depth(a2)
  1098.     tst.b    (a1)+
  1099.     beq    .L1
  1100.     lea.l    ig_SIZEOF(a2),a2
  1101.     move.l    a2,-4(a2)        ; pointer to next image structure
  1102. .L1    addq.l    #1,d1
  1103.     cmp.b    #16,d1
  1104.     bne    .L0
  1105.     clr.l    -4(a2)        ; clear last pointer 
  1106.     
  1107.     move.l    PieceB,d0        ; display image
  1108.     lsl.l    #4,d0
  1109.     move.l    DegreeB,d1
  1110.     lsl.l    #3,d1
  1111.     add.l    d0,d1
  1112.     lea.l    Pieces(pc),a1
  1113.     add.l    d1,a1
  1114.     move.l    (a1),a1
  1115.     move.l    PositionBX,d0
  1116.     lsl.w    #4,d0
  1117.     add.w    #55+370,d0
  1118.     move.l    PositionBY,d1
  1119.     lsl.w    #3,d1
  1120.     add.w    #30,d1
  1121.     move.l    Window1,a0
  1122.     move.l    wd_RPort(a0),a0
  1123.     lea.l    BlockImages,a1
  1124.     CALLINT    DrawImage
  1125.     rts
  1126.  
  1127. RotatePieceB    move.l    PieceB,d0    ; check if you can rotate it !
  1128.     lsl.l    #4,d0
  1129.     move.l    DegreeB,d1
  1130.     addq.l    #1,d1
  1131.     and.l    #3,d1
  1132.     lsl.l    #2,d1
  1133.     add.l    d0,d1
  1134.     lea.l    Pieces,a0
  1135.     add.l    d1,a0
  1136.     move.l    (a0),a0    
  1137.     move.l    12(a0),d0
  1138.     move.l    16(a0),d1
  1139.     add.l    PositionBX,d0
  1140.     add.l    PositionBY,d1
  1141.     jsr    CheckB
  1142.     tst.l    d0
  1143.     bne    .wait
  1144.  
  1145.     move.l    PieceB,d0        ; rotate piece of player B
  1146.     lsl.l    #4,d0
  1147.     move.l    DegreeB,d1
  1148.     lsl.l    #2,d1
  1149.     add.l    d0,d1
  1150.     lea.l    Pieces,a0
  1151.     
  1152.     add.l    d1,a0
  1153.     move.l    (a0),a0
  1154.     moveq.l    #0,d0
  1155.     jsr    MakeBIB        ; clear old piece
  1156.     
  1157.     add.l    #1,DegreeB
  1158.     and.l    #3,DegreeB
  1159.  
  1160.     move.l    PieceB,d0
  1161.     lsl.l    #4,d0
  1162.     move.l    DegreeB,d1
  1163.     lsl.l    #2,d1
  1164.     add.l    d0,d1
  1165.     lea.l    Pieces,a0
  1166.     add.l    d1,a0
  1167.     move.l    (a0),a0
  1168.     move.l    12(a0),d0
  1169.     move.l    16(a0),d1
  1170.     add.l    d0,PositionBX
  1171.     add.l    d1,PositionBY
  1172.     move.l    8(a0),d0
  1173.     jsr    MakeBIB
  1174. .wait    jmp    GameWait
  1175.  
  1176.  
  1177. MoveLeftB    move.l    PieceB,d0        
  1178.     lsl.l    #4,d0
  1179.     move.l    DegreeB,d1
  1180.     lsl.l    #2,d1
  1181.     add.l    d0,d1
  1182.     lea.l    Pieces,a0
  1183.     add.l    d1,a0
  1184.     move.l    (a0),a0
  1185.     move.l    PositionBX,d0
  1186.     subq.l    #1,d0
  1187.     move.l    PositionBY,d1
  1188.     jsr    CheckB        ; check if there's any room
  1189.     tst.l    d0
  1190.     bne    .wait
  1191.     moveq.l    #0,d0
  1192.     jsr    MakeBIB        ; clear old piece
  1193.     move.l    PieceB,d0
  1194.     lsl.l    #4,d0
  1195.     move.l    DegreeB,d1
  1196.     lsl.l    #2,d1
  1197.     add.l    d0,d1
  1198.     lea.l    Pieces,a0
  1199.     add.l    d1,a0
  1200.     move.l    (a0),a0
  1201.     sub.l    #1,PositionBX
  1202.     move.l    8(a0),d0
  1203.     jsr    MakeBIB
  1204. .wait    jmp    GameWait
  1205.  
  1206. MoveRightB    move.l    PieceB,d0        
  1207.     lsl.l    #4,d0
  1208.     move.l    DegreeB,d1
  1209.     lsl.l    #2,d1
  1210.     add.l    d0,d1
  1211.     lea.l    Pieces,a0
  1212.     add.l    d1,a0
  1213.     move.l    (a0),a0
  1214.     move.l    PositionBX,d0
  1215.     addq.l    #1,d0
  1216.     move.l    PositionBY,d1
  1217.     jsr    CheckB
  1218.     tst.l    d0
  1219.     bne    .wait
  1220.     moveq.l    #0,d0
  1221.     jsr    MakeBIB        ; clear old piece
  1222.     move.l    PieceB,d0
  1223.     lsl.l    #4,d0
  1224.     move.l    DegreeB,d1
  1225.     lsl.l    #2,d1
  1226.     add.l    d0,d1
  1227.     lea.l    Pieces,a0
  1228.     add.l    d1,a0
  1229.     move.l    (a0),a0
  1230.     add.l    #1,PositionBX
  1231.     move.l    8(a0),d0
  1232.     jsr    MakeBIB
  1233. .wait    jmp    GameWait
  1234.  
  1235. FallB    move.l    PieceB,d0        
  1236.     lsl.l    #4,d0
  1237.     move.l    DegreeB,d1
  1238.     lsl.l    #2,d1
  1239.     add.l    d0,d1
  1240.     lea.l    Pieces,a0
  1241.     add.l    d1,a0
  1242.     move.l    (a0),a0
  1243.     move.l    PositionBX,d0
  1244.     move.l    PositionBY,d1
  1245.     addq.l    #1,d1
  1246.     jsr    CheckB
  1247.     tst.l    d0
  1248.     bne    Drop_waitB
  1249.     moveq.l    #0,d0
  1250.     jsr    MakeBIB        ; clear old piece
  1251.     move.l    PieceB,d0
  1252.     lsl.l    #4,d0
  1253.     move.l    DegreeB,d1
  1254.     lsl.l    #2,d1
  1255.     add.l    d0,d1
  1256.     lea.l    Pieces,a0
  1257.     add.l    d1,a0
  1258.     move.l    (a0),a0
  1259.     add.l    #1,PositionBY
  1260.     move.l    8(a0),d0
  1261.     jsr    MakeBIB
  1262.     jmp    GameWait
  1263.  
  1264.  
  1265. DropPieceB    move.l    PieceB,d0        
  1266.     lsl.l    #4,d0
  1267.     move.l    DegreeB,d1
  1268.     lsl.l    #2,d1
  1269.     add.l    d0,d1
  1270.     lea.l    Pieces,a0
  1271.     add.l    d1,a0
  1272.     move.l    (a0),a0
  1273.     move.l    PositionBX,d0
  1274.     move.l    PositionBY,d1
  1275.     addq.l    #1,d1
  1276.     jsr    CheckB
  1277.     tst.l    d0
  1278.     bne    Drop_waitB
  1279.     add.l    #1,ScoreB
  1280.     moveq.l    #0,d0
  1281.     jsr    MakeBIB        ; clear old piece
  1282.     move.l    PieceB,d0
  1283.     lsl.l    #4,d0
  1284.     move.l    DegreeB,d1
  1285.     lsl.l    #2,d1
  1286.     add.l    d0,d1
  1287.     lea.l    Pieces,a0
  1288.     add.l    d1,a0
  1289.     move.l    (a0),a0
  1290.     add.l    #1,PositionBY
  1291.     move.l    8(a0),d0
  1292.     jsr    MakeBIB
  1293.     jmp    DropPieceB
  1294.  
  1295. Drop_waitB    move.l    PieceB,d0        ; copy piece into field
  1296.     lsl.l    #4,d0
  1297.     move.l    DegreeB,d1
  1298.     lsl.l    #2,d1
  1299.     add.l    d0,d1
  1300.     lea.l    Pieces,a0
  1301.     add.l    d1,a0
  1302.     move.l    (a0),a0
  1303.     lea.l    FieldB(pc),a1
  1304.     move.l    PositionBX,d0
  1305.     addq.l    #1,d0
  1306.     add.l    d0,a1
  1307.     move.l    PositionBY,d0
  1308.     mulu    #12,d0
  1309.     add.l    d0,a1
  1310.     lea.l    20(a0),a0
  1311.     moveq.l    #3,d2
  1312.     moveq.l    #3,d3
  1313. .E1    moveq.l    #3,d4
  1314. .E2    move.b    (a0)+,d0
  1315.     or.b    d0,(a1)+
  1316.     dbra    d4,.E2
  1317.     add.l    #12-4,a1
  1318.     dbra    d3,.E1
  1319.  
  1320.     jsr    ShowScores
  1321.     jsr    DeleteRowB
  1322.     jsr    NewPieceB
  1323.     tst.l    d0
  1324.     bne    GameQUITB
  1325.     jmp    GameWait
  1326.     
  1327.     
  1328.  
  1329.  
  1330. CheckB    movem.l    d1-d7/a0-a5,-(sp)    ; check if there are no blocks
  1331.     lea.l    FieldB(pc),a1
  1332.     addq.l    #1,d0
  1333.     add.l    d0,a1
  1334.     mulu    #12,d1
  1335.     add.l    d1,a1
  1336.     moveq.l    #3,d2
  1337.     lea.l    .L1(pc),a2
  1338.     moveq.l    #3,d3
  1339. .E1    moveq.l    #3,d4
  1340. .E2    move.b    (a1)+,(a2)+
  1341.     dbra    d4,.E2
  1342.     add.l    #12-4,a1
  1343.     dbra    d3,.E1
  1344.  
  1345.     move.l    20(a0),d0
  1346.     move.l    .L1,d1
  1347.     and.l    d0,d1
  1348.     move.l    d1,d0
  1349.     tst.l    d0
  1350.     bne    .E3
  1351.     move.l    24(a0),d0
  1352.     move.l    .L2,d1
  1353.     and.l    d0,d1
  1354.     move.l    d1,d0
  1355.     tst.l    d0
  1356.     bne    .E3
  1357.  
  1358.     move.l    28(a0),d0
  1359.     move.l    .L3,d1
  1360.     and.l    d0,d1
  1361.     move.l    d1,d0
  1362.     tst.l    d0
  1363.     bne    .E3
  1364.     move.l    32(a0),d0
  1365.     move.l    .L4,d1
  1366.     and.l    d0,d1
  1367.     move.l    d1,d0
  1368. .E3    movem.l    (sp)+,d1-d7/a0-a5
  1369.     rts
  1370. .L1    dc.l    0
  1371. .L2    dc.l    0
  1372. .L3    dc.l    0
  1373. .L4    dc.l    0
  1374.  
  1375.  
  1376. NewPieceB    jsr    GetPiece
  1377.     move.l    d0,PieceB
  1378.     lsl.l    #4,d0
  1379.     add.l    #Pieces,d0
  1380.     move.l    d0,a0
  1381.     move.l    (a0),a0
  1382.     moveq.l    #4,d0
  1383.     move.l    d0,PositionBX
  1384.     moveq.l    #0,d1
  1385.     move.l    d1,PositionBY
  1386.     clr.l    DegreeB
  1387.     jsr    CheckB
  1388.     tst.l    d0
  1389.     bne.s    .L1
  1390.     jsr    DisplayB
  1391.     moveq.l    #0,d0
  1392. .L1    rts
  1393.  
  1394.  
  1395. DeleteRowB    moveq.l    #1,d0        ; delete all posible rows / player B
  1396. .W1    move.l    d0,-(sp)
  1397.     bsr.s    .KillRowB
  1398.     move.l    (sp)+,d0
  1399.     addq.l    #1,d0
  1400.     cmp.w    #20,d0        ; until row 20
  1401.     bne.s    .W1
  1402.     jmp    ShowScores        ; update score
  1403.  
  1404. .KillRowB    lea.l    FieldB+1(pc),a0    ; delete row if possible
  1405.     move.l    d0,d1
  1406.     mulu    #12,d1
  1407.     add.l    d1,a0
  1408.  
  1409.     move.l    #9,d1        ; check if there are spaces
  1410. .T1    tst.b    (a0)+
  1411.     beq    .NoMove
  1412.     dbra    d1,.T1
  1413.  
  1414. .T5    add.l    #10,ScoreB
  1415.     move.l    d0,d1
  1416.     mulu    #12,d1
  1417.     lea.l    FieldB+12(pc),a1
  1418.     lea.l    FieldB(pc),a0
  1419.     add.l    d1,a0
  1420.     add.l    d1,a1
  1421. .T2    move.b    -(a0),-(a1)
  1422.     cmp.l    #FieldB,a0
  1423.     bne.s    .T2
  1424.     lea.l    FieldB+1(pc),a0
  1425.     move.l    #9,d0
  1426. .T3    move.b    #0,(a0)+
  1427.     dbra    d0,.T3
  1428.         
  1429.     move.l    Window1,a1        ; scoll it
  1430.     move.l    wd_RPort(a1),a1
  1431.     moveq.l    #0,d0    
  1432.     moveq.l    #-8,d1
  1433.     move.l    #370+55,d2
  1434.     move.l    #30,d3
  1435.     move.l    #370+160+55,d4
  1436.     move.l    4(sp),d5
  1437.     addq.l    #1,d5
  1438.     lsl.l    #3,d5
  1439.     add.l    #30,d5
  1440.     CALLGRAF    ScrollRaster
  1441.  
  1442.     SETAPEN    #0            
  1443.     RECTFILL    #55,#30,#160+55,#30+8
  1444. .NoMove    rts
  1445.  
  1446.  
  1447. GameOverB    SETAPEN    #1
  1448.     RECTFILL    #370+55+16-2,#30+65-1,#370+55+160-16+2,#30+65+30+1
  1449.     SETAPEN    #2
  1450.     RECTFILL    #370+55+16,#30+65,#370+55+160-16,#30+65+30
  1451.     SETDRMD    #RP_JAM1
  1452.     WRITE    #370+56+80-(11*4),#95+11+7,#0,<"GAME OVER !">
  1453.     WRITE    #370+55+80-(11*4),#95+11+6,#7,<"GAME OVER !">
  1454.     rts
  1455.  
  1456. *****************************************************
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462. GetPiece    move.l    NextPiece,d0
  1463.     move.l    d0,d1
  1464. .L1    add.b    $bfe801,d1
  1465.     lsr.b    #1,d1
  1466.     and.l    #7,d1
  1467.     cmp.b    #7,d1
  1468.     bne.s    .L2
  1469.     add.b    $dff007,d1
  1470.     bra.s    .L1
  1471. .L2    move.l    d1,NextPiece
  1472.     move.l    d0,-(sp)
  1473.     jsr    ShowNextPiece
  1474.     move.l    (sp)+,d0
  1475.     rts
  1476.  
  1477. GAME_ONE    move.w    #$00ff,GameOver
  1478.     move.b    #1,Player
  1479.     bra.s    WER1
  1480. GAME_TWO    clr.w    GameOver
  1481.     move.b    #2,Player
  1482. WER1    jsr    MakeRects
  1483.     move.l    #GADGETUP!RAWKEY!INTUITICKS,d0    ; modify IDCMP flags (less multitasking friendly) 
  1484.     move.l    Window1,a0
  1485.     CALLINT    ModifyIDCMP
  1486.     clr.l    DegreeA
  1487.     clr.l    DegreeB
  1488.     clr.l    ScoreA
  1489.     clr.l    ScoreB
  1490.     jsr    ShowScores        ; shoe score
  1491.     jsr    NewPieceA
  1492.     tst.l    d0
  1493.     bne    GameQUITA
  1494.     
  1495.         
  1496. GameWait    move.l    Window1,a0        ; wait .....
  1497.     move.l    wd_UserPort(a0),a0
  1498.     move.l    a0,a5
  1499.     CALLEXEC    WaitPort        
  1500.     move.l    a5,a0
  1501.     CALLEXEC    GetMsg        ; get message
  1502.     move.l    d0,a1    
  1503.     move.l    im_Class(a1),d4    ; get data
  1504.     move.w    im_Code(a1),d5
  1505.     move.w    im_Qualifier(a1),d3
  1506.     move.l    im_IAddress(a1),a4
  1507.     CALLEXEC     ReplyMsg        ; reply message
  1508.     
  1509.     moveq.l    #0,d0        
  1510.     move.b    gg_GadgetID+1(a4),d0    ; get gadget ID
  1511.  
  1512.     cmp.l    #GADGETUP,d4
  1513.     bne.s    .J1
  1514.     tst.b    d0
  1515.     beq    GameAbout
  1516.     cmp.b    #4,d0
  1517.     beq    Game_Keys
  1518.  
  1519.     bra    GameQUIT2
  1520. .J1    cmp.l    #INTUITICKS,d4
  1521.     beq    GameTIMER
  1522.     
  1523.     btst    #7,d5
  1524.     beq    GameWait 
  1525.     
  1526.     tst.b    GameOver
  1527.     bne.s    .Z1
  1528.  
  1529.     and.l    #$7f,d5
  1530.     cmp.w    LeftA,d5        ; Player A : any useful key pressed ???
  1531.     beq    MoveLeftA
  1532.     cmp.w    RightA,d5
  1533.     beq    MoveRightA
  1534.     cmp.w    RotateA,d5
  1535.     beq    RotatePieceA
  1536.     cmp.w    DropA,d5
  1537.     beq    DropPieceA
  1538.  
  1539. .Z1    tst.b    GameOver+1
  1540.     bne    GameWait
  1541.     and.l    #$7f,d5
  1542.     cmp.w    LeftB,d5        ; Player B : any useful key pressed ???
  1543.     beq    MoveLeftB
  1544.     cmp.w    RightB,d5
  1545.     beq    MoveRightB
  1546.     cmp.w    RotateB,d5
  1547.     beq    RotatePieceB
  1548.     cmp.w    DropB,d5
  1549.     beq    DropPieceB
  1550.     jmp    GameWait
  1551.  
  1552.  
  1553. GameTIMER    add.l    #1,Timer        ; check time
  1554.     and.l    #7,Timer    
  1555.     cmp.l    #3,Timer
  1556.     beq.s    .B
  1557.     tst.l    Timer
  1558.     bne    GameWait
  1559.     tst.b    GameOver
  1560.     bne    GameWait
  1561.     jmp    FallA        ; drop piece A
  1562.  
  1563. .B    tst.b    GameOver+1
  1564.     bne    GameWait
  1565.     jmp    FallB        ; drop piece B
  1566.  
  1567. GameQUIT2    move.l    d0,-(sp)        ; user quits
  1568.     move.l    #GADGETUP,d0
  1569.     move.l    Window1,a0
  1570.     CALLINT    ModifyIDCMP
  1571.     move.l    (sp)+,d0
  1572.     jmp    GameEXIT    
  1573.  
  1574. GameAbout    jsr    Info
  1575.     jmp    GameWait
  1576.     
  1577. GameQUITA    jsr    GameOverA        ; player one : game over
  1578.     move.b    #$ff,GameOver
  1579.     tst.b    GameOver+1        ; player two also game over ?
  1580.     beq    GameWait
  1581.     cmp.b    #1,Player
  1582.     bne.s    .W1
  1583.     jsr    NewScore
  1584. .W1    move.l    #GADGETUP,d0
  1585.     move.l    Window1,a0
  1586.     CALLINT    ModifyIDCMP
  1587.     bra    GQUIT3
  1588.  
  1589. GameQUITB    jsr    GameOverB
  1590.     move.b    #$ff,GameOver+1
  1591.     tst.b    GameOver        ; player two : game over
  1592.     beq    GameWait        ; player one : also game over ?
  1593.     move.l    #GADGETUP,d0
  1594.     move.l    Window1,a0
  1595.     CALLINT    ModifyIDCMP
  1596. GQUIT3    move.l    #50,d1
  1597.     CALLDOS    Delay
  1598.     SETAPEN    #0
  1599.     RECTFILL    #55,#30,#160+55,#160+30
  1600.     SETAPEN    #0
  1601.     RECTFILL    #370+55,#30,#370+160+55,#160+30
  1602.     jmp    Inwait
  1603.  
  1604. ScoreText1    dc.b    "1: xxxxxxxx",0
  1605.     even
  1606. ScoreText2    dc.b    "2: xxxxxxxx",0
  1607.     even
  1608.  
  1609. ShowScores    lea.l    ScoreText1+3(pc),a0    ; update scores
  1610.     move.l    ScoreA,d0
  1611.     jsr    MakeZahl
  1612.     lea.l    ScoreText2+3(pc),a0
  1613.     move.l    ScoreB,d0
  1614.     jsr    MakeZahl
  1615.     SETDRMD    #RP_JAM2
  1616.     SETBPEN    #0
  1617.     WRITEMEM    #320-(11*4),#20+9,#6,ScoreText1,#11
  1618.     WRITEMEM    #320-(11*4),#30+9,#7,ScoreText2,#11
  1619.     rts
  1620.  
  1621.  
  1622. MakeZahl    moveq.l    #7,d2
  1623.     moveq.l    #0,d3
  1624.     lea.l    Potenzen,a1
  1625. MZ1    move.b    #"0"-1,d1
  1626. MZ2    addq    #1,d1
  1627.     sub.l    (a1),d0
  1628.     bcc    MZ2
  1629.     add.l    (a1)+,d0
  1630.     tst.b    d2
  1631.     beq    MZ3
  1632.     cmp.b    #"0",d1
  1633.     beq    MZ4
  1634.     moveq.l    #1,d3
  1635.     bra    MZ3
  1636. MZ4    tst.b    d3
  1637.     bne    MZ3
  1638.     move.b    #" ",d1
  1639. MZ3    move.b    d1,(a0)+
  1640.     dbra    d2,MZ1
  1641.     rts
  1642. Potenzen    dc.l    10000000
  1643.     dc.l    1000000
  1644.     dc.l    100000
  1645.     dc.l    10000
  1646.     dc.l    1000
  1647.     dc.l    100
  1648.     dc.l    10
  1649.     dc.l    1
  1650.  
  1651.     
  1652. HiScores    dc.b    " 1.         xxxxxxx"
  1653.     dc.b    " 2.         xxxxxxx"
  1654.     dc.b    " 3.         xxxxxxx"
  1655.     dc.b    " 4.         xxxxxxx"
  1656.     dc.b    " 5.         xxxxxxx"
  1657.     dc.b    " 6.         xxxxxxx"
  1658.     dc.b    " 7.         xxxxxxx"
  1659.     dc.b    " 8.         xxxxxxx"
  1660.     dc.b    " 9.         xxxxxxx"
  1661.     dc.b    "10.         xxxxxxx"
  1662.     dc.b    "11.         xxxxxxx"
  1663.     dc.b    "12.         xxxxxxx"
  1664.     dc.b    "13.         xxxxxxx"
  1665.     dc.b    "14.         xxxxxxx"
  1666.     dc.b    "15.         xxxxxxx"
  1667.     dc.b    "16.         xxxxxxx"
  1668.     dc.b    "17.         xxxxxxx"
  1669.     dc.b    "18.         xxxxxxx"
  1670.     dc.b    "19.         xxxxxxx"
  1671.     dc.b    "20.         xxxxxxx"
  1672.     dc.b    "21.         xxxxxxx"
  1673.     dc.b    "22.         xxxxxxx"
  1674.     dc.b    "23.         xxxxxxx"
  1675.     dc.b    "24.         xxxxxxx"
  1676.     dc.b    "25.         xxxxxxx"
  1677.     dc.b    "26.         xxxxxxx"
  1678.     dc.b    "27.         xxxxxxx"
  1679.     dc.b    "28.         xxxxxxx"
  1680.     dc.b    "29.         xxxxxxx"
  1681.     dc.b    "30.         xxxxxxx"
  1682.     dc.b    "31.         xxxxxxx"
  1683.     dc.b    "32.         xxxxxxx"
  1684.     
  1685. DisplayHiScores
  1686.     SETDRMD    #RP_JAM2
  1687.     SETBPEN    #0    
  1688.     WRITEMEM    #55+4,#38+(0*10),#7,HiScores+(0*19),#19
  1689.     WRITEMEM    #55+4,#38+(1*10),#6,HiScores+(1*19),#19
  1690.     WRITEMEM    #55+4,#38+(2*10),#5,HiScores+(2*19),#19
  1691.     WRITEMEM    #55+4,#38+(3*10),#4,HiScores+(3*19),#19
  1692.     WRITEMEM    #55+4,#38+(4*10),#3,HiScores+(4*19),#19
  1693.     WRITEMEM    #55+4,#38+(5*10),#2,HiScores+(5*19),#19
  1694.     WRITEMEM    #55+4,#38+(6*10),#1,HiScores+(6*19),#19
  1695.     WRITEMEM    #55+4,#38+(7*10),#2,HiScores+(7*19),#19
  1696.     WRITEMEM    #55+4,#38+(8*10),#3,HiScores+(8*19),#19
  1697.     WRITEMEM    #55+4,#38+(9*10),#4,HiScores+(9*19),#19
  1698.     WRITEMEM    #55+4,#38+(10*10),#5,HiScores+(10*19),#19
  1699.     WRITEMEM    #55+4,#38+(11*10),#6,HiScores+(11*19),#19
  1700.     WRITEMEM    #55+4,#38+(12*10),#7,HiScores+(12*19),#19
  1701.     WRITEMEM    #55+4,#38+(13*10),#6,HiScores+(13*19),#19
  1702.     WRITEMEM    #55+4,#38+(14*10),#5,HiScores+(14*19),#19
  1703.     WRITEMEM    #55+4,#38+(15*10),#4,HiScores+(15*19),#19
  1704.     WRITEMEM    #55+4+370,#38+(0*10),#7,HiScores+(16*19),#19
  1705.     WRITEMEM    #55+4+370,#38+(1*10),#6,HiScores+(17*19),#19
  1706.     WRITEMEM    #55+4+370,#38+(2*10),#5,HiScores+(18*19),#19
  1707.     WRITEMEM    #55+4+370,#38+(3*10),#4,HiScores+(19*19),#19
  1708.     WRITEMEM    #55+4+370,#38+(4*10),#3,HiScores+(20*19),#19
  1709.     WRITEMEM    #55+4+370,#38+(5*10),#2,HiScores+(21*19),#19
  1710.     WRITEMEM    #55+4+370,#38+(6*10),#1,HiScores+(22*19),#19
  1711.     WRITEMEM    #55+4+370,#38+(7*10),#2,HiScores+(23*19),#19
  1712.     WRITEMEM    #55+4+370,#38+(8*10),#3,HiScores+(24*19),#19
  1713.     WRITEMEM    #55+4+370,#38+(9*10),#4,HiScores+(25*19),#19
  1714.     WRITEMEM    #55+4+370,#38+(10*10),#5,HiScores+(26*19),#19
  1715.     WRITEMEM    #55+4+370,#38+(11*10),#6,HiScores+(27*19),#19
  1716.     WRITEMEM    #55+4+370,#38+(12*10),#7,HiScores+(28*19),#19
  1717.     WRITEMEM    #55+4+370,#38+(13*10),#6,HiScores+(29*19),#19
  1718.     WRITEMEM    #55+4+370,#38+(14*10),#5,HiScores+(30*19),#19
  1719.     WRITEMEM    #55+4+370,#38+(15*10),#4,HiScores+(31*19),#19
  1720.     rts
  1721.  
  1722.     even
  1723. ScoreData    dc.b    "Roger",0,0,0
  1724.     dc.l    32
  1725.     dc.b    "Roger",0,0,0
  1726.     dc.l    31
  1727.     dc.b    "Roger",0,0,0
  1728.     dc.l    30
  1729.     dc.b    "Roger",0,0,0
  1730.     dc.l    29
  1731.     dc.b    "Roger",0,0,0
  1732.     dc.l    28
  1733.     dc.b    "Roger",0,0,0
  1734.     dc.l    27
  1735.     dc.b    "Roger",0,0,0
  1736.     dc.l    26
  1737.     dc.b    "Roger",0,0,0
  1738.     dc.l    25
  1739.     dc.b    "Roger",0,0,0
  1740.     dc.l    24
  1741.     dc.b    "Roger",0,0,0
  1742.     dc.l    23
  1743.     dc.b    "Roger",0,0,0
  1744.     dc.l    22
  1745.     dc.b    "Roger",0,0,0
  1746.     dc.l    21
  1747.     dc.b    "Roger",0,0,0
  1748.     dc.l    20
  1749.     dc.b    "Roger",0,0,0
  1750.     dc.l    19
  1751.     dc.b    "Roger",0,0,0
  1752.     dc.l    18
  1753.     dc.b    "Roger",0,0,0
  1754.     dc.l    17
  1755.     dc.b    "Roger",0,0,0
  1756.     dc.l    16
  1757.     dc.b    "Roger",0,0,0
  1758.     dc.l    15
  1759.     dc.b    "Roger",0,0,0
  1760.     dc.l    14
  1761.     dc.b    "Roger",0,0,0
  1762.     dc.l    13
  1763.     dc.b    "Roger",0,0,0
  1764.     dc.l    12
  1765.     dc.b    "Roger",0,0,0
  1766.     dc.l    11
  1767.     dc.b    "Roger",0,0,0
  1768.     dc.l    10
  1769.     dc.b    "Roger",0,0,0
  1770.     dc.l    9
  1771.     dc.b    "Roger",0,0,0
  1772.     dc.l    8
  1773.     dc.b    "Roger",0,0,0
  1774.     dc.l    7
  1775.     dc.b    "Roger",0,0,0
  1776.     dc.l    6
  1777.     dc.b    "Roger",0,0,0
  1778.     dc.l    5
  1779.     dc.b    "Roger",0,0,0
  1780.     dc.l    4
  1781.     dc.b    "Roger",0,0,0
  1782.     dc.l    3
  1783.     dc.b    "Roger",0,0,0
  1784.     dc.l    2
  1785.     dc.b    "Roger",0,0,0
  1786.     dc.l    1
  1787.     dc.b    "Roger",0,0,0
  1788.     dc.l    0
  1789.  
  1790.  
  1791. MakeScores    lea.l    HiScores+3(pc),a3
  1792.     lea.l    ScoreData(pc),a4
  1793.     move.l    #31,d5
  1794. .F1    move.l    a3,a0
  1795.     moveq.l    #7,d0
  1796. .F2    move.b    #" ",(a0)+
  1797.     dbra    d0,.F2
  1798.     moveq.l    #7,d0
  1799.     move.l    a3,a5
  1800.     move.l    a4,a6
  1801. .F3    move.b    (a4)+,d1
  1802.     tst.b    d1
  1803.     beq.s    .F4
  1804.     move.b    d1,(a3)+
  1805.     dbra    d0,.F3
  1806. .F4    lea.l    8(a5),a3
  1807.     lea.l    8(a6),a4
  1808.     move.l    (a4)+,d0
  1809.     move.l    a3,a0
  1810.     jsr    MakeZahl
  1811.     lea.l    19(a5),a3
  1812.     dbra    d5,.F1
  1813.     rts
  1814.  
  1815.  
  1816. Windowdef3    dc.w    180,55,300,90
  1817.     dc.b    1,1
  1818.     dc.l    GADGETUP
  1819.     dc.l    ACTIVATE!SMART_REFRESH!SMART_REFRESH
  1820.     dc.l    W3_G1
  1821.     dc.l    0
  1822.     dc.l    0
  1823. ScreenPtr3    dc.l    0,0
  1824.     dc.w    0,0,0,0,CUSTOMSCREEN
  1825.  
  1826. W3_G1    GADGET    W3_G2,100,70,100,0,<"OK">,1,4
  1827. W3_G2    dc.l    0
  1828.     dc.w    (300-72)/2,40
  1829.     dc.w    72,10
  1830.     dc.w    GADGHCOMP,RELVERIFY!STRINGCENTER,STRGADGET
  1831.     dc.l    0,0,0,0,W3_G2_Info
  1832.     dc.l    0,0
  1833. W3_G2_Info    dc.l    Name
  1834.     dc.l    UndoName
  1835.     dc.w    0,9
  1836.     ds.b    si_SIZEOF
  1837. Name    ds.b    12
  1838. UndoName    ds.b    12
  1839.  
  1840.  
  1841. WindowPointer set Window2
  1842.  
  1843. NewScore    move.l    ScoreData+(31*12)+8,d0    ; is 32nd score lower than your score ?
  1844.     cmp.l    ScoreA,d0
  1845.     bhi    .Y
  1846.     
  1847.     
  1848.  
  1849.     move.l    ScreenPtr1,ScreenPtr3
  1850.     lea.l    Windowdef3(pc),a0
  1851.     CALLINT    OpenWindow
  1852.     move.l    d0,Window2
  1853.     tst.l    d0
  1854. .Y    bne    .X
  1855.     rts
  1856.     
  1857. .X    SETAPEN    #2
  1858.     RECTFILL    #2,#1,#297,#88
  1859.  
  1860.     lea.l    W3_G1(pc),a0
  1861.     move.l    WindowPointer,a1
  1862.     sub.l    a2,a2
  1863.     CALLINT    RefreshGadgets    
  1864.     lea.l    W3_G2(pc),a0
  1865.     move.l    WindowPointer,a1
  1866.     sub.l    a2,a2
  1867.     CALLINT    ActivateGadget
  1868.     
  1869.     SETDRMD    #RP_JAM1
  1870.     
  1871.     WRITE    #((300-(11*8))/2)+1,#11,#0,<"Well done !">
  1872.     WRITE    #(300-(11*8))/2,#10,#1,<"Well done !">
  1873.     WRITE    #((300-(16*8))/2)+1,#26,#0,<"Enter your name :">
  1874.     WRITE    #(300-(16*8))/2,#25,#7,<"Enter your name :">
  1875.     
  1876.     move.l    Window2,a0        ; wait .....
  1877.     move.l    wd_UserPort(a0),a0
  1878.     CALLEXEC    WaitPort        
  1879.     move.l    Window2,a0
  1880.     CALLINT    CloseWindow
  1881.  
  1882.     lea.l    ScoreData+(31*12)(pc),a0
  1883.     lea.l    Name(pc),a1
  1884.     moveq.l    #7,d0
  1885. .W1    move.b    (a1)+,(a0)+
  1886.     dbra    d0,.W1
  1887.     move.l    ScoreA,(a0)
  1888.  
  1889.  
  1890.     lea.l    .Struktur(pc),a0
  1891.     movem.l    d1-d7/a0-a2,-(sp)
  1892.     move.l    a0,a2
  1893.     move.l    6(a2),d5    
  1894.     subq.l    #1,d5
  1895. .label1    moveq.l    #0,d7    
  1896.     moveq.l    #0,d6    
  1897. .label2    move.l    d6,d0
  1898.     move.l    d0,d1
  1899.     addq.l    #1,d1
  1900.     bsr    .Vergleiche
  1901.     bls    .label3
  1902.     move.l    d6,d0
  1903.     move.l    d0,d1
  1904.     addq.l    #1,d1
  1905.     moveq.l    #1,d7
  1906.     bsr    .Vertausche
  1907.     move.l    d6,d4    
  1908. .label3    addq    #1,d6
  1909.     cmp.l    d6,d5
  1910.     bhi    .label2
  1911.     move.l    d4,d5
  1912.     tst.b    d7
  1913.     bne    .label1    
  1914.     move.l    (a2),d0
  1915.     movem.l    (sp)+,d1-d7/a0-a2
  1916.     jsr    SaveHiScores
  1917.     jmp    MakeScores
  1918.  
  1919.  
  1920.  
  1921. .Vergleiche    mulu    4(a2),d0
  1922.     mulu    4(a2),d1
  1923.     add.l    (a2),d0
  1924.     add.l    (a2),d1
  1925.     move.l    d0,a0
  1926.     move.l    d1,a1
  1927.     lea.l    8(a0),a0
  1928.     lea.l    8(a1),a1
  1929.     move.w    4(a2),d2
  1930. .label4    cmpm.l    (a0)+,(a1)+
  1931.     rts
  1932.  
  1933.  
  1934. .Vertausche    mulu    4(a2),d0
  1935.     mulu    4(a2),d1
  1936.     add.l    (a2),d0
  1937.     add.l    (a2),d1
  1938.     move.l    d0,a0
  1939.     move.l    d1,a1
  1940.     move.w    4(a2),d0
  1941.     subq.l    #1,d0
  1942.     
  1943. .label9    move.b    (a0),d1
  1944.     move.b    (a1),(a0)+
  1945.     move.b    d1,(a1)+
  1946.     dbra    d0,.label9
  1947.     rts
  1948.         
  1949.         
  1950.  
  1951. .Struktur    dc.l    ScoreData
  1952.     dc.w    8+4
  1953.     dc.l    32
  1954.  
  1955.     
  1956. WindowPointer set Window1
  1957.     even
  1958. ScoreName    dc.b    "T90.HiScores",0
  1959.  
  1960.  
  1961. LoadHiScores    move.l    #ScoreName,d1
  1962.     move.l    #MODE_OLDFILE,d2
  1963.     CALLDOS    Open
  1964.     tst.l    d0
  1965.     beq    .E
  1966.     move.l    d0,d6
  1967.     move.l    d0,d1
  1968.     move.l    #ScoreData,d2
  1969.     move.l    #32*12,d3
  1970.     CALLDOS    Read
  1971.     move.l    d6,d1
  1972.     CALLDOS    Close
  1973.     lea.l    ScoreData(pc),a0
  1974.     move.l    #(32*12)-1,d0
  1975. .Q    eor.b    #$fa,(a0)+
  1976.     dbra    d0,.Q
  1977. .E    rts
  1978.             
  1979.     
  1980. SaveHiScores    lea.l    ScoreData(pc),a0
  1981.     move.l    #(32*12)-1,d0
  1982. .Q1    eor.b    #$fa,(a0)+
  1983.     dbra    d0,.Q1
  1984.     move.l    #ScoreName,d1
  1985.     move.l    #MODE_NEWFILE,d2
  1986.     CALLDOS    Open
  1987.     tst.l    d0
  1988.     beq    .E
  1989.     move.l    d0,d6
  1990.     move.l    d0,d1
  1991.     move.l    #ScoreData,d2
  1992.     move.l    #32*12,d3
  1993.     CALLDOS    Write
  1994.     move.l    d6,d1
  1995.     CALLDOS    Close
  1996. .E    lea.l    ScoreData(pc),a0
  1997.     move.l    #(32*12)-1,d0
  1998. .Q2    eor.b    #$fa,(a0)+
  1999.     dbra    d0,.Q2
  2000.     rts
  2001.  
  2002. KeyName    dc.b    "T90.Keys",0
  2003.     even
  2004. SaveKeys    move.l    #KeyName,d1        ; save key map
  2005.     move.l    #MODE_NEWFILE,d2
  2006.     CALLDOS    Open
  2007.     tst.l    d0
  2008.     beq    .E
  2009.     move.l    d0,d6
  2010.     move.l    d0,d1
  2011.     move.l    #LeftA,d2
  2012.     move.l    #4*2*2,d3
  2013.     CALLDOS    Write
  2014.     move.l    d6,d1
  2015.     CALLDOS    Close
  2016. .E    rts
  2017.  
  2018. LoadKeys    move.l    #KeyName,d1        ; load key map
  2019.     move.l    #MODE_OLDFILE,d2
  2020.     CALLDOS    Open
  2021.     tst.l    d0
  2022.     beq    .E
  2023.     move.l    d0,d6
  2024.     move.l    d0,d1
  2025.     move.l    #LeftA,d2
  2026.     move.l    #4*2*2,d3
  2027.     CALLDOS    Read
  2028.     move.l    d6,d1
  2029.     CALLDOS    Close
  2030. .E    rts
  2031.  
  2032. Windowdef4    dc.w    180,55-20,300,90+40
  2033.     dc.b    1,1
  2034.     dc.l    RAWKEY
  2035.     dc.l    ACTIVATE!SMART_REFRESH!SMART_REFRESH
  2036.     dc.l    0
  2037.     dc.l    0
  2038.     dc.l    0
  2039. ScreenPtr4    dc.l    0,0
  2040.     dc.w    0,0,0,0,CUSTOMSCREEN
  2041.  
  2042. WindowPointer set Window2
  2043.  
  2044.  
  2045.  
  2046. DEFINE_KEYS    bsr.s    SetKeys
  2047.     jmp    wait
  2048. Game_Keys    bsr.s    SetKeys
  2049.     jmp    GameWait
  2050.  
  2051.  
  2052. SetKeys    lea.l    LeftA(pc),a0
  2053.     moveq.l    #7,d0
  2054. .P2    clr.w    (a0)+
  2055.     dbra    d0,.P2
  2056.     move.l    ScreenPtr1,ScreenPtr4
  2057.     lea.l    Windowdef4(pc),a0
  2058.     CALLINT    OpenWindow
  2059.     move.l    d0,Window2
  2060.     tst.l    d0
  2061.     bne    .X
  2062.     rts
  2063. .X    SETAPEN    #2
  2064.     RECTFILL    #2,#1,#297,#88+40
  2065.  
  2066.     SETDRMD    #RP_JAM1
  2067.     WRITE    #(300-(6*8))/2,#12+1,#0,<"Keys :">    
  2068.     WRITE    #(300-(6*8))/2,#12,#6,<"Keys :">    
  2069.  
  2070.     WRITE    #(300-(24*8))/2,#10+20,#1,<"Player One : Left   :">    
  2071.     jsr    .WAIT
  2072.     move.w    d5,LeftA
  2073.     WRITEMEM    #(300-(24*8))/2+25*8,#10+20,#0,Puffer,#2
  2074.     WRITE    #(300-(24*8))/2,#20+20,#1,<"             Right  :">    
  2075.     jsr    .WAIT
  2076.     move.w    d5,RightA
  2077.     WRITEMEM    #(300-(24*8))/2+25*8,#20+20,#0,Puffer,#2
  2078.     WRITE    #(300-(24*8))/2,#30+20,#1,<"             Rotate :">    
  2079.     jsr    .WAIT
  2080.     move.w    d5,RotateA
  2081.     WRITEMEM    #(300-(24*8))/2+25*8,#30+20,#0,Puffer,#2
  2082.     WRITE    #(300-(24*8))/2,#40+20,#1,<"             Drop   :">    
  2083.     jsr    .WAIT
  2084.     move.w    d5,DropA
  2085.     WRITEMEM    #(300-(24*8))/2+25*8,#40+20,#0,Puffer,#2
  2086.     WRITE    #(300-(24*8))/2,#50+20,#7,<"Player Two : Left   :">    
  2087.     jsr    .WAIT
  2088.     move.w    d5,LeftB
  2089.     WRITEMEM    #(300-(24*8))/2+25*8,#50+20,#0,Puffer,#2
  2090.     WRITE    #(300-(24*8))/2,#60+20,#7,<"             Right  :">    
  2091.     jsr    .WAIT
  2092.     move.w    d5,RightB
  2093.     WRITEMEM    #(300-(24*8))/2+25*8,#60+20,#0,Puffer,#2
  2094.     WRITE    #(300-(24*8))/2,#70+20,#7,<"             Rotate :">    
  2095.     jsr    .WAIT
  2096.     move.w    d5,RotateB
  2097.     WRITEMEM    #(300-(24*8))/2+25*8,#70+20,#0,Puffer,#2
  2098.     WRITE    #(300-(24*8))/2,#80+20,#7,<"             Drop   :">    
  2099.     jsr    .WAIT
  2100.     move.w    d5,DropB
  2101.     WRITEMEM    #(300-(24*8))/2+25*8,#80+20,#0,Puffer,#2
  2102.  
  2103. ;
  2104. ; save key map
  2105. ;
  2106.  
  2107.     WRITE    #(300-(12*8))/2,#100+20,#1,<"Save (y/n) :">    
  2108.     
  2109.     move.l    Window2,a0        ; no more RAWKEY ...
  2110.     move.l    #VANILLAKEY,d0
  2111.     CALLINT    ModifyIDCMP
  2112.     move.l    Window2,a0        ; wait 
  2113.     move.l    wd_UserPort(a0),a0
  2114.     move.l    a0,a5
  2115.     CALLEXEC    WaitPort        
  2116.     move.l    a5,a0
  2117.     CALLEXEC    GetMsg        
  2118.     move.l    d0,a1    
  2119.     move.w    im_Code(a1),d5
  2120.     CALLEXEC     ReplyMsg
  2121.     cmp.b    #"y",d5        ; yes ?
  2122.     bne.s    .Close
  2123.         
  2124.     jsr    SaveKeys
  2125.  
  2126. .Close    move.l    Window2,a0
  2127.     CALLINT    CloseWindow
  2128.     rts
  2129. .Error    move.l    ScreenPtr1,a0
  2130.     CALLINT    DisplayBeep
  2131. .WAIT    move.l    Window2,a0        ; wait .....
  2132.     move.l    wd_UserPort(a0),a0
  2133.     move.l    a0,a5
  2134.     CALLEXEC    WaitPort        
  2135.     move.l    a5,a0
  2136.     CALLEXEC    GetMsg        ; get message
  2137.     move.l    d0,a1    
  2138.     CALLEXEC     ReplyMsg    
  2139.     move.l    Window2,a0        ; wait until you release key !
  2140.     move.l    wd_UserPort(a0),a0
  2141.     move.l    a0,a5
  2142.     CALLEXEC    WaitPort        
  2143.     move.l    a5,a0
  2144.     CALLEXEC    GetMsg        
  2145.     move.l    d0,a1    
  2146.     move.w    im_Code(a1),d5
  2147.     CALLEXEC     ReplyMsg
  2148.     and.l    #$7f,d5        ; key already defined ?
  2149.     lea.l    LeftA(pc),a0
  2150.     moveq.l    #7,d0
  2151. .P1    cmp.w    (a0)+,d5
  2152.     beq    .Error    
  2153.     dbra    d0,.P1
  2154.     lea.l    .Hex(pc),a0
  2155.     move.l    d5,d0
  2156.     lsr.w    #4,d0
  2157.     and.l    #$f,d0
  2158.     move.b    (a0,d0),Puffer
  2159.     move.l    d5,d0
  2160.     and.l    #$f,d0
  2161.     move.b    (a0,d0),Puffer+1
  2162.     rts
  2163. .Hex    dc.b    "0123456789ABCDEF"
  2164. Puffer    ds.b    2
  2165.     
  2166.  
  2167.  
  2168.